/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test_system.parser;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.StringTokenizer;

/**
 *
 * @author root
 */
public class ParserCSV {
    
    public StringBuffer parseFile(String fileName){
        StringBuffer parseResult = new StringBuffer();
        try{
            BufferedReader bufferedReader = new BufferedReader(new FileReader(fileName));
            String line = "";
            StringTokenizer token = null;
            int index = 0;
            while ((line = bufferedReader.readLine()) != null){
                token = new StringTokenizer(line, ",");
                while(token.hasMoreTokens()){
                    parseResult.append(token.nextToken() + ",");
                }
                parseResult.append(";");
            }
        }catch(Exception e){
            System.out.println("Check your file.");
            System.err.println("Parse Error: " + e.getMessage());
            System.out.println("The programm will close!");
            System.exit(0);
        }
        return parseResult;
    }
    
}
